const CONFIG = require('../../config.js');
Page({
	data: {
		navBgColor: '-webkit-gradient(linear, 0% 0%, 0% 100%,from(#1b64e5), to(#39a9ed))',
		noticeData: {},
	},

	// 获取资讯数据
	getTipsData(noticeId){
		wx.request({
			url: CONFIG.host + "/system/notice/getNoteInfo",
			data: {
				noticeId: noticeId
			},
			method: "GET",
			header: {
				'content-type': 'application/json',
				'Authorization': this.data.loginInfo.token
			},
			success: res => {
				if(res.data.code === 'success'){
					this.setData({
						noticeData: res.data.data.noticeContent,
					})
				}
			},fail: function (error) {
				console.log(error);
			}
		})
	},

  	onLoad: function (options) {
		let loginInfo = wx.getStorageSync('loginInfo') || '';
		if(loginInfo){
			this.setData({
				loginInfo : JSON.parse(loginInfo)
			})
		}
		this.getTipsData(options.noticeId);
  	},
})
